package com.quanyan.travel.web;

import com.quanyan.api.APIResponse;
import com.quanyan.api.enums.ApiResponseEnum;
import com.quanyan.travel.api.req.ReqSeasonActivities;
import com.quanyan.travel.service.TravelListService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController @RequestMapping("/api/travel/list") public class ListController {
    @Autowired private TravelListService travelListService;

    private static Logger log = LoggerFactory.getLogger(ListController.class);

    @RequestMapping(value = "/seasonActivities", method = RequestMethod.POST)
    public APIResponse<?> seasonActivities(@RequestBody @Valid ReqSeasonActivities request,
        BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            return APIResponse.returnFail(ApiResponseEnum.PARAMETER_INVALID);
        }
        return travelListService.seasonActivieies(request);
    }

}
